package com.yonyou.cyxdms.sysAuth.service.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.yonyou.cyxdms.framework.bean.entity.base.DMSBasePO;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yonyou.cyx.framework.bean.dto.base.BaseDTO;

/**
 * <p>
 * 组织
 * </p>
 *
 * @author 李贺
 * @since 2019-09-18
 */
@TableName("tm_org")
public class OrgPO extends DMSBasePO<OrgPO> {

    private static final long serialVersionUID = 1L;

    /**
     * 组织ID
     */
        @TableId(value = "ORG_ID", type = IdType.AUTO)
        private Long orgId;
    /**
     * 本身所在company_id
     */
    @TableField("APP_ID")
    private String appId;
    /**
     * 本身所在company_id
     */
    @TableField("COMPANY_ID")
    private Long companyId;
    @TableField("ORG_CODE")
    private String orgCode;
    /**
     * 组织名称
     */
    @TableField("ORG_NAME")
    private String orgName;
    /**
     * 组织名称缩写
     */
    @TableField("ORG_SHORT_NAME")
    private String orgShortName;
    /**
     * 组织描述
     */
    @TableField("ORG_DESC")
    private String orgDesc;
    /**
     * 组织类型ID:1680 ;公司、部门、大区、小区、经销商、服务站
     */
    @TableField("ORG_TYPE")
    private Integer orgType;
    /**
     * 有效，无效
     */
    @TableField("IS_VALID")
    private Integer isValid;
    /**
     * 数据参考模板ID(主要用于经销商集团创建的部门模板)
     */
    @TableField("DATA_TEMPLATE_ID")
    private Integer dataTemplateId;
    /**
     * 数据来源
     */
    @TableField("DATA_SOURCE")
    private Integer dataSource;
    /**
     * 数据类型（用于区分是经销商还是集团）
     */
    @TableField("DATA_TYPE")
    private Integer dataType;
    /**
     * 来源日期
     */
    @TableField("SOURCE_CHANGED_AT")
    private LocalDateTime sourceChangedAt;
    @TableField("IS_DELETED")
    @Version
    @TableLogic
    private Integer isDeleted;

    public OrgPO() {
        super();
    }


    public Long getOrgId() {
        return orgId;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    public String getOrgCode() {
        return orgCode;
    }

    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }

    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public String getOrgShortName() {
        return orgShortName;
    }

    public void setOrgShortName(String orgShortName) {
        this.orgShortName = orgShortName;
    }

    public String getOrgDesc() {
        return orgDesc;
    }

    public void setOrgDesc(String orgDesc) {
        this.orgDesc = orgDesc;
    }

    public Integer getOrgType() {
        return orgType;
    }

    public void setOrgType(Integer orgType) {
        this.orgType = orgType;
    }

    public Integer getIsValid() {
        return isValid;
    }

    public void setIsValid(Integer isValid) {
        this.isValid = isValid;
    }

    public Integer getDataTemplateId() {
        return dataTemplateId;
    }

    public void setDataTemplateId(Integer dataTemplateId) {
        this.dataTemplateId = dataTemplateId;
    }

    public Integer getDataSource() {
        return dataSource;
    }

    public void setDataSource(Integer dataSource) {
        this.dataSource = dataSource;
    }

    public Integer getDataType() {
        return dataType;
    }

    public void setDataType(Integer dataType) {
        this.dataType = dataType;
    }

    public LocalDateTime getSourceChangedAt() {
        return sourceChangedAt;
    }

    public void setSourceChangedAt(LocalDateTime sourceChangedAt) {
        this.sourceChangedAt = sourceChangedAt;
    }

    @Override
    public Integer getIsDeleted() {
        return isDeleted;
    }

    @Override
    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    @Override
    protected Serializable pkVal() {
        return this.orgId;
    }

    @Override
    public String toString() {
        return "OrgPO{" +
                "orgId=" + orgId +
                ", appId='" + appId + '\'' +
                ", companyId=" + companyId +
                ", orgCode='" + orgCode + '\'' +
                ", orgName='" + orgName + '\'' +
                ", orgShortName='" + orgShortName + '\'' +
                ", orgDesc='" + orgDesc + '\'' +
                ", orgType=" + orgType +
                ", isValid=" + isValid +
                ", dataTemplateId=" + dataTemplateId +
                ", dataSource=" + dataSource +
                ", dataType=" + dataType +
                ", sourceChangedAt=" + sourceChangedAt +
                ", isDeleted=" + isDeleted +
                '}';
    }


    /**
     * 将PO 信息转化为DTO
     *
     * @param dto 需要进行转换的dto
     * @author 李贺
     * @since 2018/7/22 0022
     */
    protected <T extends BaseDTO> void transDtoToPo(T dto) {
        BeanMapperUtil.copyProperties(this, dto, "orgId");
    }


}
